package cn.gson.fengboot.model.pojos;

import javax.persistence.*;
import java.util.Collection;
import java.util.Objects;

@Entity
public class Qmodel {
    private int modelId;
    private String modelName;
    private String modelNote;
    private Collection<Qmodeldetails> qmodeldetailsmodetId;
    private  QtypeEntity typeId;

    @ManyToOne
    @JoinColumn(name = "type_id", referencedColumnName = "type_id")
    public QtypeEntity getTypeId() {
        return typeId;
    }

    public void setTypeId(QtypeEntity typeId ) {
        this.typeId = typeId;
    }



    @OneToMany(mappedBy = "modelId")
    public Collection<Qmodeldetails> getQmodeldetailsmodetId() {
        return qmodeldetailsmodetId;
    }
    public void setQmodeldetailsmodetId(Collection<Qmodeldetails> qmodeldetailsmodetId) {
        this.qmodeldetailsmodetId = qmodeldetailsmodetId;
    }
    @Id
    @Column(name = "model_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "seq")
    public int getModelId() {
        return modelId;
    }

    public void setModelId(int modelId) {
        this.modelId = modelId;
    }

    @Basic
    @Column(name = "model_name")
    public String getModelName() {
        return modelName;
    }

    public void setModelName(String modelName) {
        this.modelName = modelName;
    }

    @Basic
    @Column(name = "model_note")
    public String getModelNote() {
        return modelNote;
    }

    public void setModelNote(String modelNote) {
        this.modelNote = modelNote;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Qmodel qmodel = (Qmodel) o;
        return modelId == qmodel.modelId &&
                Objects.equals(modelName, qmodel.modelName) &&
                Objects.equals(modelNote, qmodel.modelNote);
    }

    @Override
    public int hashCode() {
        return Objects.hash(modelId, modelName, modelNote);
    }

    @Override
    public String toString() {
        return "Qmodel{" +
                "modelId=" + modelId +
                ", modelName='" + modelName + '\'' +
                ", modelNote='" + modelNote + '\'' +
                ", qmodeldetailsmodetId=" + qmodeldetailsmodetId +
                ", typeId=" + typeId +
                '}';
    }
}
